#include<iostream>
#include<cstring>
#include<queue>
#include<cstdio>
using namespace std;

const int maxn = 50005;
const int maxm = 200005;

struct node{
	int next;
	int to;
	int dis;
}edge[maxm];

int num_edge,head[maxn],d[maxn];
int n,m,b,s=1;

void add_edge(int from,int to,int dis){
	num_edge++;
	edge[num_edge].next=head[from];
	edge[num_edge].to=to;
	edge[num_edge].dis=dis;
	head[from]=num_edge;
	return ;
}

void spfa(){
	bool vis[maxn];
	memset(vis,false,sizeof vis);
	int inq[maxn];
	queue<int> q;
	for(int i=1;i<=n;i++){
		d[i]=66666666;
	}
	memset(inq,0,sizeof inq);
 	inq[s]=1;q.push(s);d[s]=0;vis[s]=true;
	while(!q.empty()){
		int u=q.front();inq[u]=0;q.pop();
		for(int i=head[u];i!=0;i=edge[i].next){
			int v=edge[i].to;
			if(v==u)continue;
			int w=edge[i].dis;
			if(d[v]>d[u]+w){
				d[v]=d[u]+w;	
				if(!inq[v]){
					inq[v]=1;
					q.push(v);
				}
			}
		}
	}
}

int main(){
	cin>>n>>m>>b;
	int ri,si,li;
	for(int i=1;i<=m;i++){
		cin>>ri>>si>>li;
		add_edge(ri,si,li);
		add_edge(si,ri,li);
	}
	
	spfa();
	int p,q;
	for(int i=1;i<=b;i++){
		cin>>p>>q;
		int ans = d[p]+d[q];
		cout<<ans<<endl;
	}
	return 0;
}
